/**
 * Copyright [2019] [LiBo/Alex of copyright liboware@gmail.com ]
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.dess.base.task;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Date;
import java.util.Locale;

/**
 * @project-name:coffice-boot
 * @package-name:com.hyts.coffice.config
 * @author:LiBo/Alex
 * @create-date:2020-11-23 11:53
 * @copyright:libo-alex4java
 * @email:liboware@gmail.com
 * @description:
 */
@RequiredArgsConstructor
@Slf4j
@Configuration
public class TaskConfiguration {

    /**
     * 获取任务作业实例工厂类
     */
//    private final JobTaskFactory jobFactory;

    /**
     * @author  jinhaoxun
     * @description 配置SchedulerFactoryBean，将一个方法产生为Bean并交给Spring容器管理
     * @return SchedulerFactoryBean
     */
//    @Bean
//    public SchedulerFactoryBean schedulerFactoryBean() {
//        log.info("开始注入定时任务调度器工厂...");
//        // Spring提供SchedulerFactoryBean为Scheduler提供配置信息,并被Spring容器管理其生命周期
//        SchedulerFactoryBean factory = new SchedulerFactoryBean();
//        // 设置自定义Job Factory，用于Spring管理Job bean
//        factory.setJobFactory(jobFactory);
//        log.info("注入定时任务调度器工厂成功！");
//        return factory;
//    }
//
//    @Bean(name = "scheduler")
//    public Scheduler scheduler() {
//        return schedulerFactoryBean().getScheduler();
//    }

    public static void main(String[] args) {
        // ���ı��ػ���Ϣ
        Locale locale = Locale.CHINA;
        NumberFormat numberFormat = NumberFormat.getCurrencyInstance(locale);

        double amt = 123456.78;
        System.out.println(numberFormat.format(amt));
        // Ӣ�ı��ػ���Ϣ
        Locale locale2 = Locale.US;
        NumberFormat nFormat = NumberFormat.getCurrencyInstance(locale2);

        double amt2 = 123456.78;
        System.out.println(nFormat.format(amt2));

        Locale locale6 = Locale.ITALY;
        NumberFormat nFormat3 = NumberFormat.getCurrencyInstance(locale6);

        double amt3 = 123456.78;
        System.out.println(nFormat3.format(amt3));

        // Ӣ�ı��ػ���Ϣ
        Locale locale3 = new Locale("en", "US");
        Date date = new Date();
        // ���ձ��ػ��ķ�ʽ�����ڽ��и�ʽ������
        DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM,
                locale3);
        System.out.println(dateFormat.format(date));

        // ���ı��ػ���Ϣ
        Locale locale4 = new Locale("zh", "CN");
        Date date2 = new Date();
        // ���ձ��ػ��ķ�ʽ�����ڽ��и�ʽ������
        DateFormat dateFormat2 = DateFormat.getDateInstance(DateFormat.MEDIUM,
                locale4);
        System.out.println(dateFormat2.format(date2));

    }

}
